package com.ant.storage.controller;


import com.ant.storage.common.ResultPage;
import com.ant.storage.common.ResultVo;
import com.ant.storage.dto.BalanceListMsgDto;
import com.ant.storage.pojo.BalanceMsg;
import com.ant.storage.pojo.Inventory;
import com.ant.storage.pojo.Picking;
import com.ant.storage.service.IBalanceMsgService;
import com.ant.storage.service.IPickingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.PostConstruct;
import java.io.IOException;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hzd
 * @since 2023-10-11
 */
@RestController
@RequestMapping("/balancemsg")
@Api(tags = "结存接口")
public class BalanceMsgController {

    @Autowired
    private IBalanceMsgService balanceMsgService;


    @ApiOperation(value = "获取物品库存数据列表")
    @GetMapping("/getBalanceList")
    public ResultVo getBalanceList(BalanceListMsgDto dto) {
        List<BalanceMsg> commodityList = balanceMsgService.queryList(dto);
        return  ResultVo.success("获取成功", commodityList);
    }

    @ApiOperation(value = "保存领料单")
    @PostMapping("/saveBalanceMsg/{wid}")
    public ResultVo saveBalanceMsg(@PathVariable("wid") Integer wid) throws IOException {
        return balanceMsgService.saveBalanceMsg(wid);
    }


    @ApiOperation(value = "获取物品库存数据列表")
    @GetMapping("/getBalanceTypeList")
    public ResultVo getBalanceTypeList() {
        return  ResultVo.success("获取成功",balanceMsgService.queryTypeList());
    }
}
